package com.xquant.marketdata.marketdata.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.xquant.common.redis.service.RedisService;
import com.xquant.marketdata.marketdata.domain.TfndDTO;
import com.xquant.marketdata.marketdata.domain.TfndDividendDTO;
import com.xquant.marketdata.marketdata.domain.TfndPriceDTO;
import com.xquant.marketdata.utils.DateUtils;
import com.xquant.system.api.SysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xquant.marketdata.marketdata.mapper.TfndMapper;
import com.xquant.marketdata.marketdata.service.ITfndService;

/**
 * 基金Service业务层处理
 *
 * @author zipeng,li
 * @date 2022-03-07
 */
@Service
public class TfndServiceImpl implements ITfndService {
  @Autowired private TfndMapper tfndMapper;
  @Autowired
  private SysConfigService sysConfigService;

  public List<TfndDTO> selectTfndList(Map<String, Object> params) {
    return tfndMapper.queryFundInfoByPage(params);
  }

  @Override
  public List<TfndDividendDTO> selectTfndDividendList(Map<String, Object> params) {
    return tfndMapper.queryFundDividendByPage(params);
  }

  @Override
  public List<TfndPriceDTO> selectTfndPriceList(Map<String, Object> params) {
    return tfndMapper.queryFundPriceByPage(params);
  }

  @Override
  public void updateFundPrice(TfndPriceDTO tfndPriceDTO) {
    tfndMapper.updateFundPrice(tfndPriceDTO);
  }

  @Override
  public String getLastWorkday() {
    String begDate = DateUtils.getCurr_YYYY_MM_DD();
    Map<String, Object> hashMap = new HashMap<>();
    hashMap.put("begDate", begDate);
    return tfndMapper.getLastWorkday(hashMap);
  }
}
